package com.cndcare.msc.netty.bean;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Entity
@Data
@Table(name = "CM_DANGER_LOG")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DangerLogBean {
    public static final String WAIT_DEAL = "WAIT_DEAL";
    public static final String FALSE_ALARM = "FALSE_ALARM";
    public static final String POLICE = "POLICE";

    public static Map<String, String> statusDicMap;

    static  {
        statusDicMap = new HashMap<>();

        statusDicMap.put(DangerLogBean.WAIT_DEAL, "待处理");
        statusDicMap.put(DangerLogBean.FALSE_ALARM, "误告警");
        statusDicMap.put(DangerLogBean.POLICE, "出警");
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT 'mac地址'")
    private String mac;
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT 'ip地址'")
    private String ip;
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '地址'")
    private String address;
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '描述'")
    private String remark;
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT 'WAIT_DEAL: 待处理;FALSE_ALARM: 误告警;POLICE: 出警'")
    private String status;

    @Column(columnDefinition = "timestamp NULL DEFAULT NULL COMMENT '创建时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @Column(columnDefinition = "timestamp NULL DEFAULT NULL COMMENT '更新时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}
